﻿using SaaS.Core;
using SaaS.Model.Entity.Blogs;
using SaaS.Model.Enums;
using System;
using System.Collections.Generic;
using System.Text;
using XCore.Extensions;
using XCore.Logger;
using XCore.Dependency;

namespace Web.Blog.Services.Articles
{
    public class ArticleApplicationService : BlogApplicationServiceBase, ISingletonDependency
    {
        public bool Message(string content)
        {
            if (content.IsNullOrWhiteSpace()) throw new MessageException("留言字符不可为空", (int)LogSource.Logic);
            if (content.Length > 512) throw new MessageException("留言长度大于512个字符", (int)LogSource.Business);
            return Repository.Insert(new ArticleMessage() { Content = content });
        }
    }
}
